package br.edu.fa7.receita.async;

import android.app.ProgressDialog;
import android.os.AsyncTask;
import br.edu.fa7.receita.ui.LoginActivity;

public class LoginAsyncTask extends AsyncTask<Void, Void, Void> {

	public LoginActivity loginActivity;
	public ProgressDialog dialog; 
	
	public LoginAsyncTask(LoginActivity loginActivity) {
		this.loginActivity = loginActivity;
		this.dialog = new ProgressDialog(this.loginActivity);
	}

	
	@Override
	protected void onPreExecute() {
		dialog.setMessage("Logando...");
		dialog.show();
	}
	
	@Override
	protected Void doInBackground(Void... params) {		
		loginActivity.logar();
		return null;
	}
	
	@Override
	protected void onPostExecute(Void result) {
		dialog.setMessage("Logado com sucesso!!!");
		dialog.dismiss();
	}
}
